package com.htx.zqs.blesmartmask.utils;

import android.annotation.SuppressLint;
import android.content.Context;
import android.widget.Toast;

/**
 * Created by KomoriWu
 * on 2019/2/17.
 */


public class ToastUtils {
    private static Toast toast = null;

    public static void show(Context context, int text) {
        show(context, context.getString(text));
    }

    @SuppressLint("ShowToast")
    public static void show(Context context, String text) {
        if (toast == null) {
            toast = Toast.makeText(context, text, Toast.LENGTH_LONG);
        } else {
            toast.setText(text);
            toast.setDuration(Toast.LENGTH_LONG);
        }
        for (int i = 0; i < 2; i++) {
            toast.show();
        }
    }
}
